FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04

# 设置工作目录
WORKDIR /app

# 使用清华镜像源
RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
    sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

# 安装Python和pip
RUN apt-get update && apt-get install -y \
    python3.9 \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# 设置pip镜像源
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \
    && pip3 config set global.timeout 1000

# 复制项目文件
COPY requirements.linux.txt requirements.txt
COPY inference.py .
COPY app.py .

# 安装依赖
RUN pip3 install -r requirements.txt

# 创建模型目录
RUN mkdir -p models

# 暴露端口
EXPOSE 8000

# 启动服务
CMD ["python3", "app.py"] 